﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;


namespace simpleHotel.Business
{
    public class supports
    {
        public string GetYahooSupport()
        {
            var model = Singleton.NewDataContext();

            var query = from s in model.Supports
                        where s.IsActive == 1
                        select s;

            StringBuilder res = new StringBuilder();
            res.Append("<table width=\"100%\">");

            foreach (var y in query)
            {
                res.AppendFormat("<tr><td align=\"left\"><span>{0} - {1}</span><br/><a href='ymsgr:sendIM?{2}'><img vspace='5' hspace='5' border='0px' align='absmiddle' alt='Send us an instant message!' src='http://opi.yahoo.com/online?u={2}&w=20&m=g&t=2'></a></td></tr>", y.Name, y.Phone, y.Yahoo);
            }

            res.Append("</table>");

            return res.ToString();
        }



        /* Nghiep Pham - return yahoo list for online */

        //public Support GetYahooSupport()
        //{
        //    var obj = from s in ContextDB.Supports
        //              where s.IsActive == 1
        //              select s;
        //    if (obj.Count() > 0)
        //    {
        //        Support objSupport = ContextDB.Supports.Single(u => u.IsActive == 1);
        //        return objSupport;
        //    }
        //    return null;
        //}
    }

     
}
